﻿using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Microsoft.Win32;

namespace Blackbird.Editors
{
    /// <summary>
    /// Interaction logic for FrameEditorWindow.xaml
    /// </summary>
    public partial class FrameEditorWindow
    {
        public FrameEditorWindow()
        {
            InitializeComponent();
        }

        public ImageSource SelectedImage
        {
            get { return DisplayImage.Source; }
            set { DisplayImage.Source = value; }
        }

        private void OkButtonClick(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
        }

        private void CancelButtonClick(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
        }

        private void BrowseButtonClick(object sender, RoutedEventArgs e)
        {
            var dialog = new OpenFileDialog();
            bool? result = dialog.ShowDialog();
            if (result.Value)
            {
                SelectedImage = new BitmapImage(new Uri(dialog.FileName));
            }
        }
    }
}